/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.views;

import com.giant.entities.InBrand;
import com.giant.entities.InCatalog;
import com.giant.entities.InClass;
import com.giant.entities.InColor;
import com.giant.entities.InLine;
import com.giant.entities.InSize;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Harold
 */
@Entity
@Table(name = "in_inventory_v")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InInventoryV.findAll", query = "SELECT i FROM InInventoryV i"),
    @NamedQuery(name = "InInventoryV.findByIdOpCen", query = "SELECT i FROM InInventoryV i WHERE i.idOpCen = :idOpCen"),
    @NamedQuery(name = "InInventoryV.findByIdPos", query = "SELECT i FROM InInventoryV i WHERE i.idPos = :idPos"),
    @NamedQuery(name = "InInventoryV.findBySku", query = "SELECT i FROM InInventoryV i WHERE i.sku = :sku"),
    @NamedQuery(name = "InInventoryV.findByIdBrand", query = "SELECT i FROM InInventoryV i WHERE i.idBrand = :idBrand"),
    @NamedQuery(name = "InInventoryV.findByIdLine", query = "SELECT i FROM InInventoryV i WHERE i.idLine = :idLine"),
    @NamedQuery(name = "InInventoryV.findByIdClass", query = "SELECT i FROM InInventoryV i WHERE i.idClass = :idClass"),
    @NamedQuery(name = "InInventoryV.findByIdCatalog", query = "SELECT i FROM InInventoryV i WHERE i.idCatalog = :idCatalog"),
    @NamedQuery(name = "InInventoryV.findByIdColor", query = "SELECT i FROM InInventoryV i WHERE i.idColor = :idColor"),
    @NamedQuery(name = "InInventoryV.findByIdSize", query = "SELECT i FROM InInventoryV i WHERE i.idSize = :idSize"),
    @NamedQuery(name = "InInventoryV.findByPurchasePrice", query = "SELECT i FROM InInventoryV i WHERE i.purchasePrice = :purchasePrice"),
    @NamedQuery(name = "InInventoryV.findByAvailableQuantity", query = "SELECT i FROM InInventoryV i WHERE i.availableQuantity = :availableQuantity"),
    @NamedQuery(name = "InInventoryV.findByModelName", query = "SELECT i FROM InInventoryV i WHERE i.modelName = :modelName"),
    @NamedQuery(name = "InInventoryV.findByModelYear", query = "SELECT i FROM InInventoryV i WHERE i.modelYear = :modelYear"),
    @NamedQuery(name = "InInventoryV.findByColorDesc", query = "SELECT i FROM InInventoryV i WHERE i.colorDesc = :colorDesc"),
    @NamedQuery(name = "InInventoryV.findBySizeDesc", query = "SELECT i FROM InInventoryV i WHERE i.sizeDesc = :sizeDesc")})
public class InInventoryV implements Serializable {
    
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_op_cen")
    private int idOpCen;
    @Basic(optional = false)
    @NotNull
    @Id
    @Column(name = "id_pos")
    private int idPos;
    @Basic(optional = false)
    @NotNull
    @Id
    @Size(min = 1, max = 11)
    @Column(name = "sku")
    private String sku;
    @OneToOne
       @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false)
    })
    private InBrand idBrand;
       @OneToOne
       @JoinColumns({
        @JoinColumn(name="id_line", referencedColumnName="id_line", updatable = false, insertable = false),
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false)
    })
    private InLine idLine;
   @OneToOne
      @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand", updatable = false, insertable = false),
        @JoinColumn(name="id_line", referencedColumnName="id_line",  updatable = false, insertable = false),
        @JoinColumn(name="id_class", referencedColumnName="id_class",  updatable = false, insertable = false)
    })
    private InClass idClass;
     @OneToOne
      @JoinColumns({
        @JoinColumn(name="id_brand", referencedColumnName="id_brand"),
        @JoinColumn(name="id_line", referencedColumnName="id_line"),
        @JoinColumn(name="id_class", referencedColumnName="id_class"),
        @JoinColumn(name="id_catalog", referencedColumnName="id_catalog")
    })
    private InCatalog idCatalog;
   @OneToOne
    @JoinColumn(name = "id_color")
    private InColor idColor;
    @OneToOne
    @JoinColumn(name = "id_size")
    private InSize idSize;
    @Basic(optional = false)
    @NotNull
    @Column(name = "purchase_price")
    private float purchasePrice;
    @Basic(optional = false)
    @NotNull
    @Column(name = "sale_price")
    private float salePrice;
    @Basic(optional = false)
    @NotNull
    @Column(name = "available_quantity")
    private long availableQuantity;
    @Basic(optional = false)
    @NotNull
    @Column(name = "gross_price")
    private long grossPrice;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "model_name")
    private String modelName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "model_year")
    private int modelYear;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "color_desc")
    private String colorDesc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "size_desc")
    private String sizeDesc;
    @Basic(optional = false)
    @NotNull
    @Column(name = "order_quantity")
    private int orderQuantity;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "class_desc")
    private String classDesc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "class_desc2")
    private String classDesc2;
    public InInventoryV() {
    }

    public int getIdOpCen() {
        return idOpCen;
    }

    public void setIdOpCen(int idOpCen) {
        this.idOpCen = idOpCen;
    }

    public int getIdPos() {
        return idPos;
    }

    public void setIdPos(int idPos) {
        this.idPos = idPos;
    }

    public String getSku() {
        return sku;
    }

    public void setSku(String sku) {
        this.sku = sku;
    }

    public InBrand getBrand() {
        return idBrand;
    }

    public void setBrand(InBrand idBrand) {
        this.idBrand = idBrand;
    }

    public InLine getLine() {
        return idLine;
    }

    public void setLine(InLine idLine) {
        this.idLine = idLine;
    }

    public InClass getClasse() {
        return idClass;
    }

    public void setClasse(InClass idClass) {
        this.idClass = idClass;
    }

    public InCatalog getCatalog() {
        return idCatalog;
    }

    public void setCatalog(InCatalog idCatalog) {
        this.idCatalog = idCatalog;
    }

    public InColor getColor() {
        return idColor;
    }

    public void setColor(InColor idColor) {
        this.idColor = idColor;
    }

    public InSize getSize() {
        return idSize;
    }

    public void setSize(InSize idSize) {
        this.idSize = idSize;
    }

    public float getPurchasePrice() {
        return purchasePrice;
    }

    public void setPurchasePrice(float purchasePrice) {
        this.purchasePrice = purchasePrice;
    }
    
      public float getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(float salePrice) {
        this.salePrice = salePrice;
    }

    public long getAvailableQuantity() {
        return availableQuantity;
    }
    
     public String getIsAvailable() {
        if(availableQuantity>0)
        {
            return "Available";
        }     
        return "Not available";
        
    }

    public void setAvailableQuantity(long availableQuantity) {
        this.availableQuantity = availableQuantity;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public int getModelYear() {
        return modelYear;
    }

    public void setModelYear(int modelYear) {
        this.modelYear = modelYear;
    }

    public String getColorDesc() {
        return colorDesc;
    }

    public void setColorDesc(String colorDesc) {
        this.colorDesc = "resources/img/icons/on-road.jpg";
    }

    public String getSizeDesc() {
        return sizeDesc;
    }

    public void setSizeDesc(String sizeDesc) {
        this.sizeDesc = sizeDesc;
    }

    public int getOrderQuantity() {
        return orderQuantity;
    }

    public void setOrderQuantity(int orderQuantity) {
        this.orderQuantity = orderQuantity;
    }

    public String getClassDesc() {
        return classDesc;
    }

    public void setClassDesc(String classDesc) {
        this.classDesc = classDesc;
    }

    public String getClassDesc2() {
        return classDesc2;
    }

    public void setClassDesc2(String classDesc2) {
        this.classDesc2 = classDesc2;
    }

    public long getGrossPrice() {
        return grossPrice;
    }

    public void setGrossPrice(long grossPrice) {
        this.grossPrice = grossPrice;
    }
    
    
    
}
